home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / object oriented files / CAboutDirector.cp next >
Encoding:
Text File  |  1993-10-06  |  2.4 KB  |  100 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CAboutDirector.c
  3.  
  4.         
  5.     SUPERCLASS = CDLOGDirector
  6.     
  7.     Copyright © 1991 Symantec Corporation. All rights reserved.
  8.     
  9.  
  10.  ******************************************************************************/
  11.  
  12. #include "CAboutDirector.h"
  13. #include <CScrollPane.h>
  14. #include <CDialogText.h>
  15. #include <CDialog.h>
  16. #include <CPaneBorder.h>
  17. #include <CApplication.h>
  18. #include <CTextEnvirons.h>
  19.  
  20. static Boolean ByKind( CView *scrollPane, void* targetID)
  21.     {
  22.     return member(scrollPane, CScrollPane);
  23.     }
  24.  
  25. void CAboutDirector::IAboutDirector( short Aboutid, CDirectorOwner *aSupervisor)
  26.     {
  27.     CScrollPane *scrollPane;
  28.     Handle Data = GetResource( 'TEXT', Aboutid);
  29.     Str255    name;
  30.     ResType    rType;
  31.     FailNILRes(Data);
  32.     GetResInfo(Data,&Aboutid,&rType,name);
  33.  
  34.     CDLOGDirector::IDLOGDirector( Aboutid, aSupervisor);
  35.     
  36.     itsData = Data;    
  37.     itsWindow->SetTitle(name);
  38.     scrollPane = (CScrollPane *)itsWindow->MatchView( ByKind, 0);
  39.  
  40.     if (scrollPane)
  41.         {
  42.         StScrpHandle styleHandle = (StScrpHandle) GetResource( 'styl', Aboutid);
  43.         CPaneBorder *listBorder;
  44.         Rect    margin;
  45.         Cell    aCell;    
  46.  
  47.         itsMainPane = new(CStyleText);
  48.         itsGopher = itsMainPane;
  49.  
  50.         itsMainPane->IStyleText(scrollPane, this,
  51.                     1, 1, 0, 0, sizELASTIC, sizELASTIC, 1000);
  52.         itsMainPane->Specify( kNotEditable, kNotSelectable, kNotStylable);
  53.         itsMainPane->FitToEnclosure(TRUE, TRUE);
  54.         itsMainPane->Offset( 2, 2, FALSE);
  55.         SetRect(&margin, 0, 0, -2, -2);
  56.         itsMainPane->ChangeSize( &margin, FALSE);
  57.         
  58.         if (Data) itsMainPane->SetTextHandle(Data);
  59.  
  60.         // Install the styles
  61.         
  62.         if (styleHandle) itsMainPane->SetStyleScrap( 0, MAXINT, styleHandle, TRUE);
  63.         
  64.         scrollPane->InstallPanorama(itsMainPane);
  65.  
  66.         }
  67.     }    /* CAboutDirector::IAboutDirector */
  68.  
  69.  
  70. void CAboutDirector::Dispose( void)
  71. {
  72.     itsMainPane = 0;
  73.     inherited::Dispose();
  74. }
  75.  
  76. void    CAboutDirector::DoCommand( long theCommand)
  77.     {
  78.     Handle    Data = NULL;
  79.     StScrpHandle styleHandle = NULL;
  80.     
  81.     switch( theCommand)
  82.         {            
  83.         case 301: case 302: case 303: case 304: case 305: case 306:    case 307:
  84.         case 401: case 402: case 403: case 404: case 405: case 406:    case 407:
  85.             Data = GetResource('TEXT', (short)theCommand);
  86.             styleHandle = (StScrpHandle) GetResource( 'styl', (short)theCommand);
  87.             break;
  88.         default:
  89.             inherited::DoCommand( theCommand);
  90.             break;
  91.         }
  92.  
  93.     if (Data)             
  94.             {
  95.             itsData = Data;
  96.             itsMainPane->SetTextHandle(Data);
  97.             if (styleHandle) itsMainPane->SetStyleScrap( 0, MAXINT, styleHandle, TRUE);
  98.             }
  99.     }
  100.